package absfactory;

/**
 * 功能:
 * 作者: ldl
 * 时间: 2016-08-15 15:12
 */
public class DataAccess {

    private static final String db = "MySql";
    private static final String packageName = "absfactory";

    public static IUser createUser() {

        String className = packageName + "." + db + "User";

        try {
            return (IUser) Class.forName(className).newInstance();
        } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) {
            e.printStackTrace();
        }
        return null;
    }


    public static IDepartment createDepartment() {

        String className = packageName + "." + db + "Department";

        try {
            return (IDepartment) Class.forName(className).newInstance();
        } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) {
            e.printStackTrace();
        }
        return null;
    }
}
